/* GUI CONVERTED from rcrbrp01.p (converter v1.76) Mon Aug 26 05:13:48 2002 */
/* rcrbrp01.p - Release Management Customer Schedules                         */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.23 $                                                               */
/*V8:ConvertMode=Report                                                       */
/* REVISION: 7.3    LAST MODIFIED: 11/09/92   BY: WUG *G462*                  */
/* REVISION: 7.4    LAST MODIFIED: 09/13/93   BY: WUG *H109*                  */
/* REVISION: 7.4    LAST MODIFIED: 04/14/94   BY: WUG *H345*                  */
/* REVISION: 7.4    LAST MODIFIED: 05/04/94   BY: WUG *H363*                  */
/* REVISION: 7.4    LAST MODIFIED: 08/09/94   BY: bcm *H473*                  */
/* REVISION: 7.4    LAST MODIFIED: 11/29/94   BY: afs *H608*                  */
/* REVISION: 7.4    LAST MODIFIED: 01/20/95   by: srk *G0C1*                  */
/* REVISION: 7.4    LAST MODIFIED: 03/07/95   by: jxz *H0BS*                  */
/* REVISION: 7.3    LAST MODIFIED: 03/28/95   BY: aed *G0JC*                  */
/* REVISION: 7.4    LAST MODIFIED: 02/22/96   BY: kjm *H0J9*                  */
/* REVISION: 8.6    LAST MODIFIED: 06/11/96   BY: aal *K001*                  */
/*                                 03/19/97   BY: *K082* E. Hughart           */
/* REVISION: 8.6    LAST MODIFIED: 08/20/97   BY: *H1D5* Aruna Patil          */
/* REVISION: 8.6    LAST MODIFIED: 09/22/97   BY: *H1FK* Niranjan Ranka       */
/* REVISION: 8.6e   LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane            */
/* REVISION: 8.6e   LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan           */
/* REVISION: 8.6e   LAST MODIFIED: 06/08/98   BY: *K1RZ* Ashok Swaminathan    */
/* REVISION: 9.0    LAST MODIFIED: 02/06/99   BY: *M06R* Doug Norton          */
/* REVISION: 9.0    LAST MODIFIED: 03/13/99   BY: *M0BD* Alfred Tan           */
/* REVISION: 9.1    LAST MODIFIED: 10/01/99   BY: *N014* Patti Gaultney       */
/* REVISION: 9.1    LAST MODIFIED: 01/19/00   BY: *N077* Vijaya Pakala        */
/* REVISION: 9.1    LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane     */
/* REVISION: 9.1    LAST MODIFIED: 05/26/00   BY: *L0YC* Kaustubh K.          */
/* REVISION: 9.1    LAST MODIFIED: 08/12/00   BY: *N0KP* myb                  */
/* REVISION: 9.1    LAST MODIFIED: 09/04/00   BY: *N0RB* Mudit Mehta          */
/* Revision: 1.20      BY: Santosh Rao        DATE: 11/05/01 ECO: *M1PC*      */
/* Revision: 1.21      BY: Santosh Rao        DATE: 03/08/02 ECO: *N1C9*      */
/* Revision: 1.22      BY: Katie Hilbert      DATE: 04/15/02 ECO: *P03J*      */
/* $Revision: 1.23 $        BY: John Corda         DATE: 08/07/02 ECO: *N1QP*      */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

/* RETROBILL REPORT */


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdtitle.i "2+ "}

{gldydef.i new}
{gldynrm.i new}

define new shared variable addr        as character format "x(38)" extent 6.
define            variable rbmcust     like rbm_cust no-undo.
define            variable rbmauth     like rbm_auth no-undo.
define            variable billto      as character format "x(38)"
                                       extent 6 no-undo.
define            variable shipto      as character format "x(38)"
                                       extent 6 no-undo.
define            variable cust        like so_cust no-undo.
define            variable ship        like so_ship no-undo.
define            variable last_auth   like rbm_auth
                  column-label "Previous!Amendment Number" no-undo.
define            variable last_price  like idh_price
                  column-label "Previous!Amendment Price" no-undo.
define            variable adj_amt     like idh_price
                  column-label "Price Change"
                  format "->,>>>,>>9.99<<<" no-undo.
define            variable adj_amt_ext like idh_price
                  column-label "Extended!Price Change"
                  format "->>,>>>,>>9.99" decimals 2 no-undo.
define            variable rsn_cmmt    like code_cmmt no-undo.
define            variable i           as integer no-undo.
define            variable new_price     like rbm_newprice
                  column-label "This!Amendment Price" no-undo.
define            variable begstr        as character no-undo.
define            variable rbm_memo      like mfc_logical no-undo
                                         label "Memo Per Item".
define            variable memo_per_item like mfc_logical no-undo.
define            variable memo_per_po   like mfc_logical no-undo.
define            variable create_memos  like mfc_logical no-undo
                                         label "Create Memos".
define            variable acct          like sod_acct no-undo
                                         label "Retrobill Acct".
define            variable sub           like sod_sub no-undo.
define            variable cc            like sod_cc no-undo.
define            variable po            like so_po no-undo.
define            variable error_count   as integer no-undo.
define            variable retrobill     like pt_part no-undo.
define            variable l_dfacct      like mfc_logical
                                         label "Use Default Accounts"
                                         initial yes no-undo.
define            variable msg_text      as character no-undo.
define            variable valid_acct    like mfc_logical no-undo.
define new shared stream repout.
define buffer qadwkfl for qad_wkfl.
define buffer rbmmstr for rbm_mstr.

retrobill = getTermLabel("RETROBILL",18).


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 

   
 RECT-FRAME       AT ROW 1 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1 COLUMN 3 NO-LABEL VIEW-AS TEXT SIZE-PIXELS 1 BY 1
 SKIP(.1)  /*GUI*/
rbmcust             colon 30
   ad_name             no-label
   rbmauth             colon 30
   skip(1)
   create_memos        colon 30
   l_dfacct            colon 30
   skip(1)
   acct                colon 30
   sub                 no-label
   cc                  no-label
with frame a side-labels width 80 attr-space NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER INITIAL "".
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:HIDDEN in frame a = yes.
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5.  /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

display create_memos l_dfacct with frame a.

mainloop:
repeat transaction:
   error_count = 0.

   prompt-for
      rbmcust
      rbmauth
      create_memos
      l_dfacct
   with frame a
   editing:
      global_addr = input rbmcust.

      if frame-field = "rbmcust"
      then do:
         {mfnp05.i rbm_mstr rbm_cust yes rbm_cust "input frame a rbmcust"}
      end.
      else
      if frame-field = "rbmauth"
      then do:
         {mfnp05.i rbm_mstr rbm_cust
            "rbm_cust = input frame a rbmcust"
            rbm_auth "input frame a rbmauth"}
      end.
      else do:
         status input.
         readkey.
         apply lastkey.
      end.

      if recno <> ?
      then do:
         find ad_mstr
            where ad_addr = rbm_cust
            no-lock.
         assign
            rbmcust = rbm_cust
            rbmauth = rbm_aut.

         display
            rbmcust
            ad_name
            rbmauth
         with frame a.
      end.
   end.

   assign frame a
      rbmcust
      rbmauth
      create_memos
      l_dfacct.

   if l_dfacct
   then
      display
         "" @ acct
         "" @ sub
         "" @ cc
      with frame a.

   if l_dfacct = no
   then do:
      ldfacct:
      do on error undo ldfacct, retry:
         prompt-for
            acct
            sub
            cc
         with frame a.

         if ( { gppswd3.i &field = ""sod_acct"" } = no )
         then do:
            msg_text = "sod_acct".
            next-prompt acct with frame a.
            /* USER DOES NOT HAVE ACCESS TO THE FIELD sod_acct */
            {pxmsg.i
             &MSGNUM     = 2186
             &ERRORLEVEL = 3
             &MSGARG1    = msg_text}
            undo ldfacct, retry .
         end. /* IF GPPSWD3.I &FIELD = ""SOD_ACCT"" */

         if ( { gppswd3.i &field = ""sod_sub"" } = no )
         then do:
            msg_text = "sod_sub".
            next-prompt sub with frame a.
            /* USER DOES NOT HAVE ACCESS TO THE FIELD sod_sub */
            {pxmsg.i
             &MSGNUM     = 2186
             &ERRORLEVEL = 3
             &MSGARG1    = msg_text}
            undo ldfacct, retry .
         end. /* IF GPPSWD3.I &FIELD = ""SOD_SUB"" */

         if ( { gppswd3.i &field = ""sod_cc"" } = no )
         then do:
            msg_text = "sod_cc".
            next-prompt cc with frame a.
            /* USER DOES NOT HAVE ACCESS TO THE FIELD sod_cc */
            {pxmsg.i
             &MSGNUM     = 2186
             &ERRORLEVEL = 3
             &MSGARG1    = msg_text}
            undo ldfacct, retry .
         end. /* IF GPPSWD3.I &FIELD = ""SOD_CC"" */

         assign
            acct
            sub
            cc.

         /* CHECKING ACCT,SUB AND CC */
         /* INITIALIZE SETTINGS */
         {gprunp.i "gpglvpl" "p" "initialize"}
         /* SET PROJECT VERIFICATION TO NO */
         {gprunp.i "gpglvpl" "p" "set_proj_ver" "(input false)"}
         /* ACCT/SUB/CC/PROJ VALIDATION */
         {gprunp.i "gpglvpl" "p" "validate_fullcode"
            "(input  acct,
              input  sub,
              input  cc,
              input  """",
              output valid_acct)"}

         if valid_acct = no
         then do:
            next-prompt acct with frame a.
            undo ldfacct, retry.
         end.

      end. /* DO 0N ERROR */
   end. /* IF L_DFFACCT */

   find cm_mstr
      where cm_addr = rbmcust
      no-lock no-error.

   if not available cm_mstr
   then do:
      {pxmsg.i &MSGNUM=3 &ERRORLEVEL=3}
      undo, retry.
   end.

   find rbm_mstr
      where rbm_cust = rbmcust
        and rbm_auth = rbmauth
      exclusive-lock no-error.

   if not available rbm_mstr
   then do:
      /* Retrobill Master does not exist */
      {pxmsg.i &MSGNUM=8117 &ERRORLEVEL=3}
      next-prompt rbmauth with frame a.
      undo, retry.
   end.

   if create_memos
   then do:
      if substring(rbm_status,1,1) = "i"
      then do:
         /* Retrobill memo has already been created */
         {pxmsg.i &MSGNUM=8127 &ERRORLEVEL=3}
         next-prompt create_memos with frame a.
         undo, retry.
      end.

   end. /* if create_memos */

   find ad_mstr
      where ad_addr = rbm_cust
      no-lock.

   display ad_name
   with frame a.

   rsn_cmmt = "".
   find code_mstr
      where code_fldname = "rbm_rsn"
        and code_value   = rbm_rsn
      no-lock no-error.
   if available code_mstr
   then
      rsn_cmmt = code_cmmt.

   do while true:
      {mfselprt.i "printer" 132 page "stream repout"}
/*GUI*/ RECT-FRAME:HEIGHT-PIXELS in frame a = FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.

      if report-to-window
         and create_memos
      then do:
         output stream repout close.
         {mfguidel.i}
         /* OUTPUT TO WINDOW NOT ALLOWED WHEN CREATE MEMOS IS YES */
         {pxmsg.i &MSGNUM=3855 &ERRORLEVEL=3}
         report-to-window = no.
      end. /* IF REPORT-TO-WINDOW AND CREATE_MEMOS */
      else
         leave.
   end. /* DO WHILE TRUE */

   {mfphead.i "stream repout" "(repout)"}

   FORM /*GUI*/  with STREAM-IO /*GUI*/  frame heading      /* DESCOPE IT */
      width 132.

   begstr = string(rbm_cust,"x(8)") + string(rbm_auth,"x(16)").

   run do-printing.

   if error_count > 0
   then do:
      /* Error messages produced */
      {pxmsg.i
       &MSGNUM     = 8234
       &ERRORLEVEL = 2
       &MSGARG1    = "error_count"}
      {pxmsg.i &MSGNUM=4467 &ERRORLEVEL=1} /* Memos were not created */
      undo, retry.
   end.

   if create_memos
   then do:
      substring(rbm_status,1,1) = "i".
   end.

   {mfrtrail.i "stream repout"}

end.

PROCEDURE do-printing:

   define buffer qadwkfl for qad_wkfl.
   define buffer rbmmstr for rbm_mstr.

   for each qad_wkfl
      exclusive-lock
      where qad_key1 = "rbd_det"
        and qad_key2 begins begstr,
       each ih_hist
      no-lock
      where ih_nbr        = qad_charfld[5]
        and ih_inv_date  >= qad_datefld[1] - 100      /*narrow it down*/
        and ih_inv_date  <= qad_datefld[2] + 100      /*narrow it down*/
        and ih_ship_date >= qad_datefld[1]
        and ih_ship_date <= qad_datefld[2]
        use-index ih_nbr,
       each idh_hist no-lock
      where idh_inv_nbr = ih_inv_nbr
        and idh_nbr     = ih_nbr
        and idh_line    = integer(qad_charfld[6])
      break by qad_charfld[4]             /*po*/
            by qad_charfld[3]             /*part*/
            by qad_charfld[1]             /*shipfrom*/
            by qad_charfld[2]             /*shipto*/
            by idh_hist.idh_custref       /*Cust Ref*/
            by idh_hist.idh_modelyr       /*Model Year*/
            by ih_inv_nbr with frame f-a:

      if first-of(qad_charfld[2])
      then do:
         find ad_mstr
            where ad_addr = ih_ship
            no-lock.

         assign
            addr[1] = ad_name
            addr[2] = ad_line1
            addr[3] = ad_line2
            addr[4] = ad_line3
            addr[6] = ad_country.
         {mfcsz.i addr[5] ad_city ad_state ad_zip}.

         {gprun.i ""gpaddr.p"" }
         assign
            shipto[1] = addr[1]
            shipto[2] = addr[2]
            shipto[3] = addr[3]
            shipto[4] = addr[4]
            shipto[5] = addr[5]
            shipto[6] = addr[6]
            ship      = ad_addr.

         find ad_mstr
            where ad_addr = ih_cust
            no-lock.

         assign
            addr[1] = ad_name
            addr[2] = ad_line1
            addr[3] = ad_line2
            addr[4] = ad_line3
            addr[6] = ad_country.
         {mfcsz.i addr[5] ad_city ad_state ad_zip}.

         {gprun.i ""gpaddr.p"" }

         assign
            billto[1] = addr[1]
            billto[2] = addr[2]
            billto[3] = addr[3]
            billto[4] = addr[4]
            billto[5] = addr[5]
            billto[6] = addr[6]
            cust      = ad_addr.

         find pt_mstr
            where pt_part = idh_part
            no-lock no-error.

         assign
            rbm_memo      = substring(rbm_mstr.rbm_ar_nbr,1,1) = "y"
            memo_per_item = rbm_memo
            memo_per_po   = not rbm_memo.

         /* SET EXTERNAL LABELS */
         setFrameLabels(frame heading:handle).
         display stream repout
            skip(1)
            getTermLabelRtColon("SOLD_TO",8)     at 10
            cust                           no-label
            rbm_auth                       colon 78 label "Amendment Number"
            billto[1]                      at 19 no-label
            rbm_eff                        colon 78 label "As-of Date"
            billto[2]                      at 19 no-label
            rbm_rsn                        colon 78
            rsn_cmmt                       no-label
            billto[3]                      at 19 no-label
            rbm_memo                       colon 78
            billto[4]                      at 19 no-label
            billto[5]                      at 19 no-label
            billto[6]                      at 19 no-label
            skip(1)
            idh_contr_id                   colon 17 format "x(22)"
                                                    label "PO Number"
            ih_nbr                         colon 78
            idh_part                       colon 17
            idh_line                       colon 78 format ">>>9"
            idh_custpart                   colon 17
            idh_custref                    colon 17
            idh_modelyr                    colon 17
            qad_datefld[1]                 colon 78 label "From Ship Date"
            pt_desc1                       colon 17 when (available pt_mstr)
            qad_datefld[2]                 colon 78 label "To Ship Date"
            ih_site                        colon 17 label "Ship From"
            getTermLabelRtColon("SHIP_TO",8)     at 10
            ship                           no-label
            shipto[1]                      at 19 no-label
            shipto[2]                      at 19 no-label
            shipto[3]                      at 19 no-label
            shipto[4]                      at 19 no-label
            shipto[5]                      at 19 no-label
            shipto[6]                      at 19 no-label
            skip(1)
         with frame heading page-top width 132 no-box side-labels STREAM-IO /*GUI*/ .

         if rbm_cmtindx > 0
         then do:
            put skip(1).
            {gpcmtprt.i &type=RP &id=rbm_cmtindx &pos=19}
            put skip(1).
         end.
      end.

      /* FIGURE LAST AUTH AND LAST PRICE.  WE DO THIS BY LOOKING AT ALL
       * PREVIOUS RETROBILL DATA FOR THIS SALES ORDER THAT HAPPEN TO
       * INCLUDE THIS INVOICE. */

      assign
         last_auth  = ""
         last_price = idh_price.

      do for qadwkfl, rbmmstr:
         for each qadwkfl
            no-lock
            where qad_key3       = "rbd_det"
              and qad_key4       = qad_wkfl.qad_key4
              and qad_datefld[1] <= ih_ship_date
              and qad_datefld[2] >= ih_ship_date,
             each rbmmstr
            no-lock
            where rbmmstr.rbm_cust = qad_charfld[7]
              and rbmmstr.rbm_auth = qad_charfld[8]
              and
               (
               rbmmstr.rbm_eff < rbm_mstr.rbm_eff
               or
               (
               rbmmstr.rbm_eff = rbm_mstr.rbm_eff
               and
               rbmmstr.rbm_auth < rbm_mstr.rbm_auth
               )
               )
            break by rbmmstr.rbm_eff
                  by rbmmstr.rbm_auth:
            last_auth = qad_charfld[8].

            if qad_charfld[9] = "y"
            then
               last_price = qad_decfld[1].
            else
               last_price = last_price + qad_decfld[1].
         end.
      end.

      if qad_charfld[9] = "y"
      then
         new_price = qad_decfld[1].
      else
         new_price = last_price + qad_decfld[1].

      assign
         adj_amt     = new_price - last_price
         adj_amt_ext = adj_amt * idh_qty_inv.

      accumulate adj_amt_ext(sub-total by qad_charfld[4] by qad_charfld[3]).
      accumulate idh_qty_inv(sub-total by qad_charfld[4] by qad_charfld[3]).

      FORM /*GUI*/ 
         ih_inv_nbr        format "x(10)"
         ih_ship_date
         idh_price         column-label "Original Price"
                           format "->>>,>>>,>>9.99<<<"
         last_auth
         last_price        format "->>>,>>>,>>9.99<<<"
         new_price         format "->>>,>>>,>>9.99<<<"
         adj_amt
         idh_qty_inv
         idh_um
         adj_amt_ext
      with STREAM-IO /*GUI*/  frame f-a width 132 no-box.

      setFrameLabels(frame f-a:handle). /* SET EXTERNAL LABELS */

      display stream repout
         ih_inv_nbr
         ih_ship_date
         idh_price
         last_auth
         last_price        when (last_auth > "")
         new_price
         adj_amt
         idh_qty_inv
         idh_um
         adj_amt_ext WITH STREAM-IO /*GUI*/ .

      if last-of(qad_charfld[2])
      then do:                                      /* SHIP-TO */
         if last-of(qad_charfld[3])
         then do:                                   /* PART    */
            if create_memos and memo_per_item
            then do:
/************* INPUT/OUTPUT PARAMETERS FOR CALL TO RCRBRP1A.P ****************
 *             INPUT RBM_CUST                                  SOLD-TO CUSTOMER
 *             INPUT RBM_AUTH                                  AUTHORIZATION NBR
 *             INPUT
 *             (ACCUM SUB-TOTAL BY QAD_CHARFLD[3] ADJ_AMT_EXT) AMOUNT
 *             INPUT ACCT                                      SALES ACCOUNT
 *             INPUT SUB                                       SALES SUBACCT
 *             INPUT CC                                        SALES COST CENTER
 *             INPUT QAD_CHARFLD[4]                            PO
 *             INPUT QAD_CHARFLD[3]                            ITEM NBR
 *             INPUT QAD_CHARFLD[2]                            SHIP-TO
 *             INPUT QAD_CHARFLD[1]                            SHIP-FROM
 *             INPUT IH_BILL                                   BILL-TO
 *             OUTPUT QAD_CHARFLD[10]                          MEMO NBR
 *             OUTPUT QAD_CHARFLD[11]                          SO NBR
 *             INPUT-OUTPUT ERROR_COUNT
 **************************************************************************** */
               {gprun.i ""rcrbrp1a.p""
                  "(input rbm_cust,
                    input rbm_auth,
                    input (accum sub-total by qad_charfld[3] adj_amt_ext),
                    input acct, input sub, input cc,
                    input qad_charfld[4],
                    input qad_charfld[3],
                    input qad_charfld[2],
                    input qad_charfld[1],
                    input ih_bill,
                    output qad_charfld[10],
                    output qad_charfld[11],
                    input-output error_count)"}
            end.

            underline stream repout
               idh_qty_inv
               adj_amt_ext.

            display stream repout
               getTermLabel("ITEM_TOTAL",10) @ ih_inv_nbr
               getTermLabel("MEMO",4) + ": " + qad_charfld[10] format "x(14)"
                  when (memo_per_item) @ last_price
               getTermLabel("SALES_ORDER",2) + ": " + qad_charfld[11]
                  format "x(14)" when (memo_per_item) @ new_price
               accum sub-total by qad_charfld[3] adj_amt_ext @ adj_amt_ext
               accum sub-total by qad_charfld[3] idh_qty_inv @ idh_qty_inv WITH STREAM-IO /*GUI*/ .

            if last-of(qad_charfld[4])
            then do:
               if create_memos and memo_per_po
               then do:
                  {gprun.i ""rcrbrp1a.p""
                     "(input rbm_cust,
                       input rbm_auth,
                       input (accum sub-total by qad_charfld[3] adj_amt_ext),
                       input acct,
                       input sub,
                       input cc,
                       input qad_charfld[4],
                       input retrobill,
                       input qad_charfld[2],
                       input qad_charfld[1],
                       input ih_bill,
                       output qad_charfld[10],
                       output qad_charfld[11],
                       input-output error_count)"}
               end.

               underline stream repout
                  idh_qty_inv
                  adj_amt_ext.

               display stream repout
                  getTermLabel("PO_TOTAL",10) @ ih_inv_nbr
                  getTermLabel("MEMO",4) + ": " + qad_charfld[10] format "x(14)"
                     when (memo_per_item) @ last_price
                  getTermLabel("SALES_ORDER",2) + ": " +
                     qad_charfld[11] format "x(14)" when (memo_per_item)
                     @ new_price
                  accum sub-total by qad_charfld[4] adj_amt_ext @ adj_amt_ext
                  accum sub-total by qad_charfld[4] idh_qty_inv @ idh_qty_inv WITH STREAM-IO /*GUI*/ .
            end.
         end.

         hide stream repout frame heading.
         page stream repout.
      end.
   end.
END PROCEDURE. /* do printing */
